package com.ruoyi.system.domain.vo;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;


public class TProjectVo implements Serializable {

    @Data
    @ApiModel("项目管理")
    public class Result{
        @ApiModelProperty("id")
        private Long id;
        @Excel(name = "项目编号")
        @ApiModelProperty("项目编号")
        private String projectNum;
        @Excel(name = "项目名称")
        @ApiModelProperty("项目名称")
        private String topicName;
        @Excel(name = "项目简称")
        @ApiModelProperty("项目简称")
        private String topicShortName;
        @ApiModelProperty("类型")
        private Byte type;
        @ApiModelProperty("类别")
        private String category;
        @Excel(name = "牵头单位")
        @ApiModelProperty("牵头单位")
        private String leadingUnit;
        @Excel(name = "负责人")
        @ApiModelProperty("负责人")
        private String person;
        @ApiModelProperty("状态")
        private Byte status;
        @ApiModelProperty("上报省平台状态（0未上报  1已上报）")
        private Byte sptStatus;
        @ApiModelProperty("上报脑防委状态（0未上报  1已上报）")
        private Byte nfwStatus;
        @ApiModelProperty("附件地址")
        private String file;
        @ApiModelProperty("创建者")
        private String createBy;
        @ApiModelProperty(" 创建时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date createTime;
        @ApiModelProperty("更新者")
        private String updateBy;
        @ApiModelProperty(" 修改时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date updateTime;

        @Excel(name = "类型")
        private String typeString;

        @Excel(name = "状态")
        private String statusString;


        @Excel(name = "类别")
        private String categoryString;
        public String getTypeString() {
            if (type != null) {
                if (type == 1) {
                    return "预防性研究";
                }
                if (type == 2) {
                    return "干预性研究";
                }
                if (type == 3) {
                    return "流行病学研究";
                }
            }
            return "";
        }

        public String getCategoryString() {
            if (StrUtil.isNotEmpty(category)) {
                if ("0".equals(category)) {
                    return "院外基层筛查";
                }
                if ("1".equals(category)) {
                    return "院外基层干预";
                }
                if ("2".equals(category)) {
                    return "院内卒中住院人群分布";
                }
                if ("3".equals(category)) {
                    return "临床科研项目";
                }
                if ("4".equals(category)) {
                    return "推广项目";
                }
                if ("5".equals(category)) {
                    return "横向临床研究项目";
                }
                if ("6".equals(category)) {
                    return "其他";
                }
            }
            return categoryString;
        }

        public String getStatusString() {
            if (status != null) {
                if (status == 0) {
                    return "未提交";
                }
                if (status == 1) {
                    return "已提交";
                }
                if (status == 2) {
                    return "已审核";
                }
                if (status == 3) {
                    return "驳回";
                }
            }
            return statusString;
        }

    }

    @Data
    @ApiModel("TProjectVo - ProjectCategory")
    public static class ProjectCategory{
        private Long id;
        @ApiModelProperty(" 名称")
        private String name;
        @ApiModelProperty(" 创建人")
        private String createBy;
        @ApiModelProperty(" 修改时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date createTime;
        @ApiModelProperty(" 修改时间")
        private String updateBy;
        @ApiModelProperty(" 修改时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date updateTime;
    }

}